(() => {
  abstract class Animal {
    name: string
    age: number
    constructor(name: string, age: number) {
      this.name = name
      this.age = age
    }

    // 抽象方法只能定义在抽象类中,子类必须对方法进行重写
    abstract say(): void;
  }

  class Dog extends Animal {
    sex: number
    constructor(name: string, age: number, sex: number) {
      super(name, age)
      this.sex = sex
    }
    say(): void {
      console.log('哈哈哈哈');
    }
  }
})()